package com.my.demo;

import com.sun.jna.Library;
import com.sun.jna.Native;

public class GisTest {

    public interface GisLib extends Library {
        GisLib INSTANCE = Native.load(("libgis.so"), GisTest.GisLib.class);

        /**
         * 求两条路线A和B的交并差集
         *
         * @param path1      指定路线A的经纬度数据的存储路径
         * @param path2      指定路线B的经纬度数据的存储路径
         * @param flag       需要使用的功能，包括交集(flag = 0)，并集(flag =1)，差集(flag =2)。
         * @param targetPath 目标数据存储路径
         */
        void get_set(String path1, String path2, int flag, String targetPath);

        /**
         * 求路段A是否是路段B的一部分
         *
         * @param path1 指定路线A的经纬度数据的存储路径
         * @param path2 指定路线B的经纬度数据的存储路径
         * @return 0： 否， 1： 是
         */
        int match(String path1, String path2);

        /**
         * 判断点是否在指定的GIS地图上
         *
         * @param point 点经纬度，格式(经度,维度)
         * @param path  指定路线的经纬度数据存储路径
         * @return 返回点到直线的距离
         */
        double get_out_dis(String point, String path);
    }

    public static void main(String[] args) {

        String dir = "/home/marshal/test/file";

        String src = "[[104.13249284354971,28.357002468152189],[104.13248413803073,28.357044085151927],[104.13246739630246,28.357116105232038],[104.13241683597776,28.357327739379944],[104.13237062808808,28.357512515560707],[104.13232508914747,28.357678995688154],[104.13228222866908,28.357830128182492],[104.13222798316187,28.358018454117506],[104.13214025124257,28.358291802617071],[104.13206591274763,28.358510249769445],[104.13198956423452,28.358718666188427],[104.13192326120323,28.358894611608452],[104.1318408844688,28.359112476706237],[104.13176520442556,28.359303186266676],[104.13169823065095,28.359469098653825],[104.13160647630463,28.359695825591444],[104.13157265447231,28.359781732540288],[104.13150534513443,28.359942628030318],[104.13141894804924,28.360154003376216],[104.13133656913375,28.360354160600906],[104.13126222701027,28.360535423155824],[104.13118855466472,28.36072022534027],[104.13111823064233,28.360890859705243],[104.13102446495286,28.361116994585728],[104.13091395498644,28.361383277966148],[104.13083626319806,28.361578115146056],[104.13076191970204,28.361757604315567],[104.13068288751093,28.361944770303502],[104.13061725083188,28.362109495028481],[104.1305382183136,28.362298430527495],[104.1304712417006,28.362464926436484],[104.13040292515193,28.362629062990209],[104.13034264587462,28.362777846423],[104.13028638504501,28.362915412401247],[104.13023146366454,28.363050025921336],[104.13015376955904,28.363234236417615],[104.13007674531039,28.363423756852832],[104.13000708838472,28.363594384229124],[104.12995082688511,28.363731948692493],[104.12987447178213,28.363917926329112],[104.1297961071857,28.364110397183026],[104.12971171427122,28.3643170374096],[104.12964875410965,28.364466410629653],[104.1295804354875,28.364628772343355],[104.1295134566177,28.364795853173376],[104.12944513793826,28.364964705509642],[104.12935203667902,28.3651937777667],[104.12927300057378,28.36538211520833],[104.12920669048134,28.365540931915543],[104.12913837107179,28.365710372671067],[104.12906134401983,28.365899886774965],[104.12899637286588,28.366051619454119],[104.12892135486648,28.366236999629326],[104.12884030827495,28.366434188333862],[104.12875122382621,28.366653219636966],[104.12867821445028,28.366830334494697],[104.12858243127333,28.367064124802617],[104.12851143095155,28.367237695790909],[104.1284678928703,28.367342783391592],[104.12839756226315,28.367519303543961],[104.12831919333027,28.367708224345666],[104.12824685246754,28.367880024939016],[104.12817719095835,28.368051232107177],[104.1281128877514,28.368206500172764],[104.12804791477092,28.368368259805653],[104.12799432849148,28.3684969608638],[104.12792198703838,28.368675250740321],[104.12786237223031,28.3688234311854],[104.12779070007721,28.3689958185158],[104.12772706585679,28.369151083850614],[104.12764132667185,28.369355350924764],[104.12758305095909,28.369501168163456],[104.12751137801385,28.369672373677211],[104.12744774320859,28.369829407866607],[104.12738745731481,28.36997463619355],[104.12731846365347,28.370149378343893],[104.12725214877833,28.370307594531461],[104.12718918287587,28.370455185103474],[104.12712822678108,28.370607494028022],[104.12707262908508,28.370740323875427],[104.12701100270282,28.370890272528943],[104.12695138584786,28.371037858399667],[104.12688774958579,28.371191939185117],[104.12682277361833,28.371353102145122],[104.12673234273532,28.371573890389175],[104.12664927991027,28.371774017180986],[104.12657425531943,28.371957612621859],[104.12650927848439,28.372116413534883],[104.12645434940413,28.372248649816964],[104.12638736286165,28.372416893549865],[104.12631903602127,28.372579237400355],[104.12623932120449,28.372769916607513],[104.12616027651401,28.372970626067698],[104.12609127908959,28.373131789170134],[104.12602027236774,28.373310066349706],[104.12593787707436,28.373506057056218],[104.12586151080548,28.373695550260241],[104.12579988154822,28.373844312619585],[104.12574830042995,28.373968871319448],[104.12567260328855,28.374151871773158],[104.12561030372827,28.374302994163941],[104.12553393645193,28.374491305127776],[104.12545890844953,28.374669582967861],[104.12540062800458,28.374817159830965],[104.12532225024371,28.375006061515386],[104.12523717345202,28.375215621890945],[104.1251701835927,28.375379138188073],[104.12509448486782,28.375564495327477],[104.12502079556427,28.375743359238125],[104.12493772725611,28.375942294240517],[104.12487006699395,28.376114070507985],[104.12481245460164,28.376247482139021],[104.12474881321397,28.376403321948853],[104.12468852132507,28.376553257510633],[104.1246141608776,28.376732119589381],[104.12455520844219,28.376877332650828],[104.12448620692602,28.377042617274295],[104.12440648660888,28.377236234850891],[104.12434686385548,28.37738498791175],[104.12428724073828,28.377528430099257],[104.12422359789704,28.37768072674503],[104.12416196490697,28.377833611220776],[104.12409564209139,28.377993580531886],[104.12404070797471,28.378127576102589],[104.12395964634069,28.378322962163463],[104.12390002266734,28.378474663269678],[104.12383235941148,28.378640532968014],[104.123769385488,28.378794006709612],[104.12370239119133,28.378943353461764],[104.12363338774001,28.379117484078673],[104.12356572372222,28.379282172163869],[104.12350475917248,28.379435642657548],[104.12343575475707,28.3795997411885],[104.12337010018251,28.379762656152216],[104.12330846474292,28.379906685407178],[104.12323008089162,28.380103244200662],[104.12316241561682,28.380263799647306],[104.12308671087942,28.380447963995572],[104.12302708497016,28.38059553029894],[104.12295874939628,28.380762575745379],[104.1228850540307,28.380944376800031],[104.12282810736338,28.381082498931146],[104.1227812100429,28.381197009953731],[104.12272962277882,28.381320375665869],[104.12263850747212,28.381541133745969],[104.12256883088656,28.381711128367094],[104.12247436509314,28.381938968694545],[104.12241674772191,28.382083579920298],[104.12235444019099,28.382234685439141],[104.12229682234189,28.382374575747825],[104.12222848476726,28.382541616990672],[104.1221641667692,28.382696263513825],[104.12209716867913,28.382857402446586],[104.12202749060008,28.383027983929107],[104.12195580228818,28.383201516922941],[104.1218747342098,28.383403969320042],[104.12179768538974,28.383586946552736],[104.12171996676845,28.383781724542654],[104.12164224762707,28.383970011647328],[104.12155514826009,28.384180137407341],[104.12147340857108,28.384377277309763],[104.12140238876536,28.38455198645222],[104.12133806878697,28.38471075872604],[104.12127910866889,28.384856545509816],[104.12121344801871,28.38501059800576],[104.12113505722154,28.385199472383729],[104.12107274659951,28.385354111336092],[104.12100574573525,28.385519964332342],[104.12094075440694,28.385673424761173],[104.12085767282217,28.385878231849734],[104.12079536146632,28.3860322792934],[104.12072902980167,28.386195180034267],[104.12066470792374,28.386350998497083],[104.1205983755025,28.386504458170155],[104.12054477408584,28.386644336666691],[104.12048179158313,28.386792482787911],[104.12041143885962,28.386964235287255],[104.1203417558298,28.387131266683635],[104.12028279329775,28.387277048444052],[104.12022584072595,28.387418108160794],[104.12015548733271,28.38759162916794],[104.12008513355936,28.387761019645854],[104.12001008922982,28.387939853653812],[104.11991896403489,28.388165900937366],[104.11983587899236,28.388371880769004],[104.1197635139673,28.388541860928598],[104.11968511872729,28.388736625794426],[104.11961945378081,28.38889125958227],[104.11955177911912,28.389065364853039],[104.11948410399118,28.389232979624765],[104.11941843849347,28.38938761229679],[104.1193474123092,28.389554048860212],[104.11927705614156,28.389722844516491],[104.11920401967215,28.38990167187853],[104.11912629253007,28.390091712418094],[104.11905191520533,28.390267589835734],[104.11897887849565,28.39045703582045],[104.1189091913277,28.390624648760262],[104.11883481334887,28.390801114810113],[104.11876646616759,28.390971675897873],[104.11870079876572,28.391128074613725],[104.11864786272587,28.391255553616649],[104.11858755594898,28.391406637732494],[104.11851116698759,28.391594313173105],[104.11844683907997,28.391748349497732],[104.11838988197989,28.391885860213133],[104.11832622402166,28.392042845358748],[104.11826792626782,28.392179176475231],[104.11819957722288,28.392344424257413],[104.11814194959074,28.392487244187095],[104.11806488904935,28.392675507166814],[104.11801597226449,28.3927959005169],[104.11795901427267,28.3929369490715],[104.11790540640121,28.393064425194261],[104.11786520071736,28.393167111993272],[104.11779014942799,28.3933471118647],[104.11772916998315,28.393491112082305],[104.11767690203276,28.39362094616234],[104.11761659264303,28.393769075226107],[104.11753819002139,28.393957335644831],[104.11748324105443,28.394090120647245],[104.11743365295015,28.394212281948761],[104.11738004427578,28.394349195407667],[104.1173237544449,28.394479030671018],[104.11725138200923,28.394655485334582],[104.11719107144528,28.394801842230017],[104.11712137927911,28.394976524287483],[104.1170523567702,28.395143535722614],[104.11697864315401,28.395321169548129],[104.11691699161764,28.395470475817227],[104.11685668028618,28.395619190878207],[104.11679167793281,28.395780298275263],[104.11673136612532,28.395925472817588],[104.11666971390645,28.396074187792429],[104.11660806164842,28.396225852312128],[104.11653769724951,28.396394041523543],[104.11646800289446,28.396563409817446],[104.11639495780369,28.396745169297407],[104.1163312941014,28.396895063738516],[104.11626494991795,28.39705793893237],[104.11620664753252,28.397206649253839],[104.11614700426456,28.397348280505064],[104.1160779786977,28.397511746320642],[104.116016325108,28.3976693073322],[104.11596003208572,28.397802085968348],[104.1158997181785,28.397949026084913],[104.11584878622948,28.398071181383049],[104.11576635690115,28.398274771500592],[104.11568995852835,28.398458888428774],[104.11562428262528,28.398619399631379],[104.11556195745629,28.398774008746035],[104.11550633362916,28.398908554663148],[104.11542993421294,28.399088540145378],[104.11537229974456,28.399232526029909],[104.11532538777035,28.399347597025248],[104.11527981618528,28.399462667005853],[104.11521547904199,28.39961019595351],[104.1151578439566,28.399752410872686],[104.11508814543279,28.399922360763739],[104.11502514859885,28.400078147252174],[104.11495477931608,28.400245736913007],[104.1148736869429,28.400441650353056],[104.11481337029048,28.400591534527528],[104.11474501102713,28.400756761904706],[104.1146934064144,28.40088304217721],[104.11462973807302,28.401035287159427],[104.11456472962546,28.401201691390334],[104.1145064223472,28.401337413940578],[104.11445347683154,28.401467823555119],[104.11438712713903,28.401629507936342],[104.11432814930696,28.40176935962668],[104.11426045905083,28.401939303309263],[104.11419276801614,28.4020956778131],[104.11412105616719,28.402276831925612],[104.1140547051719,28.402430845092862],[104.11399170528577,28.402582496235841],[104.11391261938162,28.402756573862082],[104.1138435868308,28.402915306909776],[104.11377790495405,28.403061058994773],[104.11372160568146,28.403177308517755],[104.11365257239335,28.403332500857],[104.11356879296548,28.403500089577339],[104.11351182307291,28.403621058092671],[104.11344613962399,28.403752649954733],[104.1133878284962,28.403865949471847],[104.11332549571219,28.4039863301474],[104.11325511962121,28.404118513563272],[104.11318206248862,28.40426013703339],[104.11310364278299,28.404404712623769],[104.11301248748683,28.404562862946268],[104.11291664007716,28.404731633972006],[104.11286033795999,28.404831951783557],[104.11280068421783,28.404934630838728],[104.11273030579447,28.405050883586952],[104.11266327855205,28.40516241487018],[104.11259222944578,28.405280437146011],[104.11251514746141,28.40540495137078],[104.1124454385356,28.405522972320561],[104.11235427971472,28.4056616511272],[104.11228121847165,28.405776133456897],[104.11220815678726,28.405885896038576],[104.11215319311945,28.40597618187617],[104.11207275756411,28.406092436671614],[104.1120070684381,28.406190396270745],[104.11192596193256,28.406304880929358],[104.11183614126109,28.406434117492338],[104.11176106688512,28.406539749641681],[104.11168264067652,28.40664951251318],[104.11160890648283,28.406755143385602],[104.11153986397559,28.406847793457167],[104.11147216186528,28.406938082955808],[104.11139239380807,28.40704548547092],[104.11132200997288,28.407139905089611],[104.11125363675244,28.407228424309196],[104.11128044995121,28.407197146348228],[104.11118459287816,28.407315173810161],[104.11111487869398,28.407408412484596],[104.11103510908731,28.407509914220878],[104.11095667968502,28.407605515824859],[104.11086685449911,28.40772176924478],[104.11077233609649,28.407833304895295],[104.11068988369233,28.407934216390125],[104.1106127936674,28.408026276477557],[104.11052095563392,28.408136039986484],[104.11043179839321,28.4082369531777],[104.11034666303607,28.4083355046305],[104.11024141639301,28.408454711003106],[104.11015695061307,28.408551491595606],[104.11007784732732,28.408639420934286],[104.10997930283484,28.408745055141768],[104.1099075729817,28.408824132135159],[104.10984187622927,28.408895537616985],[104.10975539754064,28.408989367684789],[104.10964947724226,28.409099722419263],[104.10954355642555,28.4092100765903],[104.10946378028203,28.409293284408896],[104.10938735574918,28.409371771361979],[104.10931897549958,28.409437866903385],[104.10922713123736,28.409529926920136],[104.10912858259483,28.40962906787675],[104.10903941902393,28.4097158168707],[104.10896165199385,28.409791353135915],[104.10889662240037,28.409853316692523],[104.10887818617047,28.409871610386396],[104.10886611880419,28.40988341282149],[104.10885740346875,28.409891674616059]]";
        String lineA = "[[104.13249284354971,28.357002468152189],[104.13248413803073,28.357044085151927],[104.13246739630246,28.357116105232038],[104.13241683597776,28.357327739379944],[104.13237062808808,28.357512515560707]]";
        String lineB = "[[104.13241683597776,28.357327739379944],[104.13237062808808,28.357512515560707],[104.13232508914747,28.357678995688154],[104.13228222866908,28.357830128182492],[104.13222798316187,28.358018454117506],[104.13214025124257,28.358291802617071],[104.13206591274763,28.358510249769445],[104.13198956423452,28.358718666188427],[104.13192326120323,28.358894611608452],[104.1318408844688,28.359112476706237],[104.13176520442556,28.359303186266676],[104.13169823065095,28.359469098653825],[104.13160647630463,28.359695825591444],[104.13157265447231,28.359781732540288],[104.13150534513443,28.359942628030318],[104.13141894804924,28.360154003376216],[104.13133656913375,28.360354160600906],[104.13126222701027,28.360535423155824],[104.13118855466472,28.36072022534027],[104.13111823064233,28.360890859705243],[104.13102446495286,28.361116994585728],[104.13091395498644,28.361383277966148],[104.13083626319806,28.361578115146056],[104.13076191970204,28.361757604315567],[104.13068288751093,28.361944770303502],[104.13061725083188,28.362109495028481],[104.1305382183136,28.362298430527495],[104.1304712417006,28.362464926436484],[104.13040292515193,28.362629062990209],[104.13034264587462,28.362777846423],[104.13028638504501,28.362915412401247],[104.13023146366454,28.363050025921336],[104.13015376955904,28.363234236417615],[104.13007674531039,28.363423756852832],[104.13000708838472,28.363594384229124],[104.12995082688511,28.363731948692493],[104.12987447178213,28.363917926329112],[104.1297961071857,28.364110397183026],[104.12971171427122,28.3643170374096],[104.12964875410965,28.364466410629653],[104.1295804354875,28.364628772343355],[104.1295134566177,28.364795853173376],[104.12944513793826,28.364964705509642],[104.12935203667902,28.3651937777667],[104.12927300057378,28.36538211520833],[104.12920669048134,28.365540931915543],[104.12913837107179,28.365710372671067],[104.12906134401983,28.365899886774965],[104.12899637286588,28.366051619454119],[104.12892135486648,28.366236999629326],[104.12884030827495,28.366434188333862],[104.12875122382621,28.366653219636966],[104.12867821445028,28.366830334494697],[104.12858243127333,28.367064124802617],[104.12851143095155,28.367237695790909],[104.1284678928703,28.367342783391592],[104.12839756226315,28.367519303543961],[104.12831919333027,28.367708224345666],[104.12824685246754,28.367880024939016],[104.12817719095835,28.368051232107177],[104.1281128877514,28.368206500172764],[104.12804791477092,28.368368259805653],[104.12799432849148,28.3684969608638],[104.12792198703838,28.368675250740321],[104.12786237223031,28.3688234311854],[104.12779070007721,28.3689958185158],[104.12772706585679,28.369151083850614],[104.12764132667185,28.369355350924764],[104.12758305095909,28.369501168163456],[104.12751137801385,28.369672373677211],[104.12744774320859,28.369829407866607],[104.12738745731481,28.36997463619355],[104.12731846365347,28.370149378343893],[104.12725214877833,28.370307594531461],[104.12718918287587,28.370455185103474],[104.12712822678108,28.370607494028022],[104.12707262908508,28.370740323875427],[104.12701100270282,28.370890272528943],[104.12695138584786,28.371037858399667],[104.12688774958579,28.371191939185117],[104.12682277361833,28.371353102145122],[104.12673234273532,28.371573890389175],[104.12664927991027,28.371774017180986],[104.12657425531943,28.371957612621859],[104.12650927848439,28.372116413534883],[104.12645434940413,28.372248649816964],[104.12638736286165,28.372416893549865],[104.12631903602127,28.372579237400355],[104.12623932120449,28.372769916607513],[104.12616027651401,28.372970626067698],[104.12609127908959,28.373131789170134],[104.12602027236774,28.373310066349706],[104.12593787707436,28.373506057056218],[104.12586151080548,28.373695550260241],[104.12579988154822,28.373844312619585],[104.12574830042995,28.373968871319448],[104.12567260328855,28.374151871773158],[104.12561030372827,28.374302994163941],[104.12553393645193,28.374491305127776],[104.12545890844953,28.374669582967861],[104.12540062800458,28.374817159830965],[104.12532225024371,28.375006061515386],[104.12523717345202,28.375215621890945],[104.1251701835927,28.375379138188073],[104.12509448486782,28.375564495327477],[104.12502079556427,28.375743359238125],[104.12493772725611,28.375942294240517],[104.12487006699395,28.376114070507985],[104.12481245460164,28.376247482139021],[104.12474881321397,28.376403321948853],[104.12468852132507,28.376553257510633],[104.1246141608776,28.376732119589381],[104.12455520844219,28.376877332650828],[104.12448620692602,28.377042617274295],[104.12440648660888,28.377236234850891],[104.12434686385548,28.37738498791175],[104.12428724073828,28.377528430099257],[104.12422359789704,28.37768072674503],[104.12416196490697,28.377833611220776],[104.12409564209139,28.377993580531886],[104.12404070797471,28.378127576102589],[104.12395964634069,28.378322962163463],[104.12390002266734,28.378474663269678],[104.12383235941148,28.378640532968014],[104.123769385488,28.378794006709612],[104.12370239119133,28.378943353461764],[104.12363338774001,28.379117484078673],[104.12356572372222,28.379282172163869],[104.12350475917248,28.379435642657548],[104.12343575475707,28.3795997411885],[104.12337010018251,28.379762656152216],[104.12330846474292,28.379906685407178],[104.12323008089162,28.380103244200662],[104.12316241561682,28.380263799647306],[104.12308671087942,28.380447963995572],[104.12302708497016,28.38059553029894],[104.12295874939628,28.380762575745379],[104.1228850540307,28.380944376800031],[104.12282810736338,28.381082498931146],[104.1227812100429,28.381197009953731],[104.12272962277882,28.381320375665869],[104.12263850747212,28.381541133745969],[104.12256883088656,28.381711128367094],[104.12247436509314,28.381938968694545],[104.12241674772191,28.382083579920298],[104.12235444019099,28.382234685439141],[104.12229682234189,28.382374575747825],[104.12222848476726,28.382541616990672],[104.1221641667692,28.382696263513825],[104.12209716867913,28.382857402446586],[104.12202749060008,28.383027983929107],[104.12195580228818,28.383201516922941],[104.1218747342098,28.383403969320042],[104.12179768538974,28.383586946552736],[104.12171996676845,28.383781724542654],[104.12164224762707,28.383970011647328],[104.12155514826009,28.384180137407341],[104.12147340857108,28.384377277309763],[104.12140238876536,28.38455198645222],[104.12133806878697,28.38471075872604],[104.12127910866889,28.384856545509816],[104.12121344801871,28.38501059800576],[104.12113505722154,28.385199472383729],[104.12107274659951,28.385354111336092],[104.12100574573525,28.385519964332342],[104.12094075440694,28.385673424761173],[104.12085767282217,28.385878231849734],[104.12079536146632,28.3860322792934],[104.12072902980167,28.386195180034267],[104.12066470792374,28.386350998497083],[104.1205983755025,28.386504458170155],[104.12054477408584,28.386644336666691],[104.12048179158313,28.386792482787911],[104.12041143885962,28.386964235287255],[104.1203417558298,28.387131266683635],[104.12028279329775,28.387277048444052],[104.12022584072595,28.387418108160794],[104.12015548733271,28.38759162916794],[104.12008513355936,28.387761019645854],[104.12001008922982,28.387939853653812],[104.11991896403489,28.388165900937366],[104.11983587899236,28.388371880769004],[104.1197635139673,28.388541860928598],[104.11968511872729,28.388736625794426],[104.11961945378081,28.38889125958227],[104.11955177911912,28.389065364853039],[104.11948410399118,28.389232979624765],[104.11941843849347,28.38938761229679],[104.1193474123092,28.389554048860212],[104.11927705614156,28.389722844516491],[104.11920401967215,28.38990167187853],[104.11912629253007,28.390091712418094],[104.11905191520533,28.390267589835734],[104.11897887849565,28.39045703582045],[104.1189091913277,28.390624648760262],[104.11883481334887,28.390801114810113],[104.11876646616759,28.390971675897873],[104.11870079876572,28.391128074613725],[104.11864786272587,28.391255553616649],[104.11858755594898,28.391406637732494],[104.11851116698759,28.391594313173105],[104.11844683907997,28.391748349497732],[104.11838988197989,28.391885860213133],[104.11832622402166,28.392042845358748],[104.11826792626782,28.392179176475231],[104.11819957722288,28.392344424257413],[104.11814194959074,28.392487244187095],[104.11806488904935,28.392675507166814],[104.11801597226449,28.3927959005169],[104.11795901427267,28.3929369490715],[104.11790540640121,28.393064425194261],[104.11786520071736,28.393167111993272],[104.11779014942799,28.3933471118647],[104.11772916998315,28.393491112082305],[104.11767690203276,28.39362094616234],[104.11761659264303,28.393769075226107],[104.11753819002139,28.393957335644831],[104.11748324105443,28.394090120647245],[104.11743365295015,28.394212281948761],[104.11738004427578,28.394349195407667],[104.1173237544449,28.394479030671018],[104.11725138200923,28.394655485334582],[104.11719107144528,28.394801842230017],[104.11712137927911,28.394976524287483],[104.1170523567702,28.395143535722614],[104.11697864315401,28.395321169548129],[104.11691699161764,28.395470475817227],[104.11685668028618,28.395619190878207],[104.11679167793281,28.395780298275263],[104.11673136612532,28.395925472817588],[104.11666971390645,28.396074187792429],[104.11660806164842,28.396225852312128],[104.11653769724951,28.396394041523543],[104.11646800289446,28.396563409817446],[104.11639495780369,28.396745169297407],[104.1163312941014,28.396895063738516],[104.11626494991795,28.39705793893237],[104.11620664753252,28.397206649253839],[104.11614700426456,28.397348280505064],[104.1160779786977,28.397511746320642],[104.116016325108,28.3976693073322],[104.11596003208572,28.397802085968348],[104.1158997181785,28.397949026084913],[104.11584878622948,28.398071181383049],[104.11576635690115,28.398274771500592],[104.11568995852835,28.398458888428774],[104.11562428262528,28.398619399631379],[104.11556195745629,28.398774008746035],[104.11550633362916,28.398908554663148],[104.11542993421294,28.399088540145378],[104.11537229974456,28.399232526029909],[104.11532538777035,28.399347597025248],[104.11527981618528,28.399462667005853],[104.11521547904199,28.39961019595351],[104.1151578439566,28.399752410872686],[104.11508814543279,28.399922360763739],[104.11502514859885,28.400078147252174],[104.11495477931608,28.400245736913007],[104.1148736869429,28.400441650353056],[104.11481337029048,28.400591534527528],[104.11474501102713,28.400756761904706],[104.1146934064144,28.40088304217721],[104.11462973807302,28.401035287159427],[104.11456472962546,28.401201691390334],[104.1145064223472,28.401337413940578],[104.11445347683154,28.401467823555119],[104.11438712713903,28.401629507936342],[104.11432814930696,28.40176935962668],[104.11426045905083,28.401939303309263],[104.11419276801614,28.4020956778131],[104.11412105616719,28.402276831925612],[104.1140547051719,28.402430845092862],[104.11399170528577,28.402582496235841],[104.11391261938162,28.402756573862082],[104.1138435868308,28.402915306909776],[104.11377790495405,28.403061058994773],[104.11372160568146,28.403177308517755],[104.11365257239335,28.403332500857],[104.11356879296548,28.403500089577339],[104.11351182307291,28.403621058092671],[104.11344613962399,28.403752649954733],[104.1133878284962,28.403865949471847],[104.11332549571219,28.4039863301474],[104.11325511962121,28.404118513563272],[104.11318206248862,28.40426013703339],[104.11310364278299,28.404404712623769],[104.11301248748683,28.404562862946268],[104.11291664007716,28.404731633972006],[104.11286033795999,28.404831951783557],[104.11280068421783,28.404934630838728],[104.11273030579447,28.405050883586952],[104.11266327855205,28.40516241487018],[104.11259222944578,28.405280437146011],[104.11251514746141,28.40540495137078],[104.1124454385356,28.405522972320561],[104.11235427971472,28.4056616511272],[104.11228121847165,28.405776133456897],[104.11220815678726,28.405885896038576],[104.11215319311945,28.40597618187617],[104.11207275756411,28.406092436671614],[104.1120070684381,28.406190396270745],[104.11192596193256,28.406304880929358],[104.11183614126109,28.406434117492338],[104.11176106688512,28.406539749641681],[104.11168264067652,28.40664951251318],[104.11160890648283,28.406755143385602],[104.11153986397559,28.406847793457167],[104.11147216186528,28.406938082955808],[104.11139239380807,28.40704548547092],[104.11132200997288,28.407139905089611],[104.11125363675244,28.407228424309196],[104.11128044995121,28.407197146348228],[104.11118459287816,28.407315173810161],[104.11111487869398,28.407408412484596],[104.11103510908731,28.407509914220878],[104.11095667968502,28.407605515824859],[104.11086685449911,28.40772176924478],[104.11077233609649,28.407833304895295],[104.11068988369233,28.407934216390125],[104.1106127936674,28.408026276477557],[104.11052095563392,28.408136039986484],[104.11043179839321,28.4082369531777],[104.11034666303607,28.4083355046305],[104.11024141639301,28.408454711003106],[104.11015695061307,28.408551491595606],[104.11007784732732,28.408639420934286],[104.10997930283484,28.408745055141768],[104.1099075729817,28.408824132135159],[104.10984187622927,28.408895537616985],[104.10975539754064,28.408989367684789],[104.10964947724226,28.409099722419263],[104.10954355642555,28.4092100765903],[104.10946378028203,28.409293284408896],[104.10938735574918,28.409371771361979],[104.10931897549958,28.409437866903385],[104.10922713123736,28.409529926920136],[104.10912858259483,28.40962906787675],[104.10903941902393,28.4097158168707],[104.10896165199385,28.409791353135915],[104.10889662240037,28.409853316692523],[104.10887818617047,28.409871610386396],[104.10886611880419,28.40988341282149],[104.10885740346875,28.409891674616059]]";

        String lineAFilename = GisUtils.createFilename(dir + "/lineA", ".txt");
        String lineBFilename = GisUtils.createFilename(dir + "/lineB", ".txt");
        String targetFilename = GisUtils.createFilename(dir + "/target", ".txt");
        GisUtils.saveLineToFile(GisUtils.parse(lineA), lineAFilename);
        GisUtils.saveLineToFile(GisUtils.parse(lineB), lineBFilename);


        testGetSet(lineAFilename, lineBFilename, 1, targetFilename);
        String line = GisUtils.readFileToLine(targetFilename);
        System.out.println(line.equals(src));

//        GisUtils.saveLineToFile(GisUtils.parse(src), targetFilename);
//        String point = "104.13232508914747,28.357678995688154";
//        System.out.println(testDistance(point, lineAFilename));
//        System.out.println(testMatch(lineAFilename, lineBFilename));

    }

    private static void testGetSet(String path1, String path2, int flag, String tar) {
        GisLib.INSTANCE.get_set(path1, path2, flag, tar);
    }

    private static int testMatch(String path1, String path2) {
        return GisLib.INSTANCE.match(path1, path2);
    }

    private static double testDistance(String point, String path) {
        return GisLib.INSTANCE.get_out_dis(point, path);
    }
}